home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / iritsm3s.zip / AMBIGUIT.IRT < prev    next >
Text File  |  1991-09-04  |  885b  |  40 lines

  1. #
  2. # The most common example of wireframe ambiguity. See for example:
  3. # Geometric Modeling by Michael E. Mortenson, page 4...
  4. #
  5.  
  6. save_res = resolution;
  7. save_view = view_mat;
  8.  
  9. view_mat = view_mat * scale(vector(0.6, 0.6, 0.6)) * rotx(30) * roty(20);
  10.  
  11. A = box(vector(-0.5, -0.5, -0.55), 1.0, 1.0, 1.1);
  12.  
  13. resolution = 4;            # To create 4 sided pyramids from cones...
  14. C1 = cone(vector(0.0, 0.0, -0.6), vector(0.0, 0.0,  0.6), 0.6 * sqrt(2.0)) *
  15.     rotz(45);
  16. C2 = cone(vector(0.0, 0.0,  0.6), vector(0.0, 0.0, -0.6), 0.6 * sqrt(2.0)) *
  17.     rotz(45);
  18.  
  19. A = A - C1 - C2;
  20. free(C1);
  21. free(C2);
  22. view(list(A), 1);
  23.  
  24. B = box(vector(-0.3, -0.3, -1.0), 0.6, 0.6, 2.0);
  25. C = A - B;
  26. free(A);
  27. free(B);
  28.  
  29. final = convex(C);
  30. free(C);
  31.  
  32. beep(1000,100);
  33. interact(list(final), 0);
  34.  
  35. save("ambiguit", list(view_mat,final));
  36. free(final);
  37.  
  38. view_mat = save_view;
  39. resolution = save_res;
  40.